﻿using System;
using System.Windows;

using Rio.Manager.Application.ViewModel.Administration;
using Rio.Manager.Application.ViewModel.FolderTypeAdministration;
using Rio.Manager.Application.ViewModel.GeneralTabs;

using Telerik.Windows.Controls;

namespace Rio.Manager.Application.Utils
{
    public class ViewSelector : DataTemplateSelector
    {
        #region Properties

        public DataTemplate CustomerTabView
        {
            get;
            set;
        }

        public DataTemplate AdministrationTabView
        {
            get;
            set;
        }

        public DataTemplate DashboardTabView
        {
            get;
            set;
        }

        public DataTemplate FolderTypeAdministrationTabView
        {
            get;
            set;
        }

        public DataTemplate GeneralParametersTabView
        {
            get; set;
        }

        public DataTemplate ListUndoCheckOutTabView
        {
            get;
            set;
        }

        public DataTemplate ManageWorkflowModelTabView
        {
            get; set;
        }

        public DataTemplate ManageWorkflowTabView
        {
            get; set;
        }

        public DataTemplate NewWorkflowTabView
        {
            get; set;
        }

        public DataTemplate VersioningModelTabView
        {
            get;
            set;
        }

        public DataTemplate ConnectorTabView { get; set; }

        public DataTemplate ConnectorAddTabView { get; set; }

        public DataTemplate BarCodeTabView { get; set; }

        public DataTemplate BarCodeAddTabView { get; set; }

        public DataTemplate GroupAssociationTabView { get; set; }

        public DataTemplate GroupSynchronizationTabView { get; set; }

        #endregion Properties

        #region Methods

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item is AdministrationTabViewModel)
            {
                return AdministrationTabView;
            }
            else if (item is DashboardTabViewModel)
            {
                return DashboardTabView;
            }
            else if (item is FolderTypeAdministrationTabViewModel)
            {
                return FolderTypeAdministrationTabView;
            }
            else if (item is VersioningModelTabViewModel)
            {
                return VersioningModelTabView;
            }
            else if (item is ListUndoCheckOutTabViewModel)
            {
                return ListUndoCheckOutTabView;
            }
            else if (item is GeneralParametersTabViewModel)
            {
                return GeneralParametersTabView;
            }
            else if (item is NewWorkflowTabViewModel)
            {
                return NewWorkflowTabView;
            }
            else if (item is ManageWorkflowTabViewModel)
            {
                return ManageWorkflowTabView;
            }
            else if (item is ManageWorkflowModelTabViewModel)
            {
                return ManageWorkflowModelTabView;
            }
            else if (item is ConnectorTabViewModel)
            {
                return ConnectorTabView;
            }
            else if (item is ConnectorAddTabViewModel)
            {
                return ConnectorAddTabView;
            }
            else if (item is BarCodeTabViewModel)
            {
                return BarCodeTabView;
            }
            else if (item is BarCodeAddTabViewModel)
            {
                return BarCodeAddTabView;
            }
            else if (item is GroupAssociationTabViewModel)
            {
                return GroupAssociationTabView;
            }
            else if (item is GroupSynchronizationTabViewModel)
            {
                return GroupSynchronizationTabView;
            }
            else
            {
                throw new Exception("No DataTemplate defined.");
            }
        }

        #endregion Methods
    }
}